package com.songdehuai.supermarket.supermarket.entity;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

public class SuperMarket implements Parcelable {


    /**
     * shop : {"shopimage":["http://imgcdn.gonghuijia.cn/app_union/resources/images/store/shop/20180420085444_5452.jpg"],"shopname":"沃尔玛-长春测试店","shopphone":"18249550991","shopaddr":"吉林省长春市朝阳区重庆街道安华公寓","distance":"9.1","months":0,"isappointment":true,"isdispatching":true,"starttime":"00:00","endtime":"24:00","patchingscope":50,"deliveryfee":0,"suppicbc":false,"mealfee":0}
     * product : [{"menu":"生鲜","icon":null,"products":[{"id":909,"productname":"苹果","lineprice":"8.80","price":"7.90","image":"http://imgcdn.gonghuijia.cn/app_union/resources/images106/file_1522473288000.jpg","months":0},{"id":910,"productname":"芒果","lineprice":"9.90","price":"8.80","image":"http://imgcdn.gonghuijia.cn/app_union/resources/images106/file_1522473288000.jpg","months":0},{"id":18760,"productname":"橘子","lineprice":"10.00","price":"0.01","image":"http://imgcdn.gonghuijia.cn/app_union/resources/images164/file_1525832177000.jpg","months":0}]},{"menu":"海外","icon":null,"products":[{"id":911,"productname":"美国鲨鱼","lineprice":"199.00","price":"188.00","image":"http://imgcdn.gonghuijia.cn/app_union/resources/images106/file_1522473288000.jpg","months":0},{"id":912,"productname":"英国蓝鲸","lineprice":"199.00","price":"188.00","image":"http://imgcdn.gonghuijia.cn/app_union/resources/images106/file_1522473288000.jpg","months":0},{"id":18559,"productname":"卡文迪-水果味硬质糖果","lineprice":"23.00","price":"0.01","image":"http://imgcdn.gonghuijia.cn/app_union/resources/images164/shangpin/file_1524883456000.jpg","months":0}]},{"menu":"水果","icon":null,"products":[]}]
     * evaluation : {"amount":1,"evaluations":[{"name":"","img":null,"star":1,"remark":"零颗星","evatime":"2018-04-20"}]}
     * user : {"degree":4,"rate":0.03,"wcoin":0}
     */

    private ShopBean shop;
    private EvaluationBean evaluation;
    private UserBean user;
    private List<ProductBean> product;

    public ShopBean getShop() {
        return shop;
    }

    public void setShop(ShopBean shop) {
        this.shop = shop;
    }

    public EvaluationBean getEvaluation() {
        return evaluation;
    }

    public void setEvaluation(EvaluationBean evaluation) {
        this.evaluation = evaluation;
    }

    public UserBean getUser() {
        return user;
    }

    public void setUser(UserBean user) {
        this.user = user;
    }

    public List<ProductBean> getProduct() {
        return product;
    }

    public void setProduct(List<ProductBean> product) {
        this.product = product;
    }

    public static class ShopBean implements Parcelable {

        /**
         * shopimage : ["http://imgcdn.gonghuijia.cn/app_union/resources/images/store/shop/20180420085444_5452.jpg"]
         * shopname : 沃尔玛-长春测试店
         * shopphone : 18249550991
         * shopaddr : 吉林省长春市朝阳区重庆街道安华公寓
         * distance : 9.1
         * months : 0
         * isappointment : true
         * isdispatching : true
         * starttime : 00:00
         * endtime : 24:00
         * patchingscope : 50
         * deliveryfee : 0
         * suppicbc : false
         * mealfee : 0
         */

        private String shopname;
        private String shopphone;
        private String shopaddr;
        private String distance;
        private int months;
        private boolean isappointment;
        private boolean isdispatching;
        private String starttime;
        private String endtime;
        private int patchingscope;
        private int deliveryfee;
        private boolean suppicbc;
        private int mealfee;
        private List<String> shopimage;

        public String getShopname() {
            return shopname;
        }

        public void setShopname(String shopname) {
            this.shopname = shopname;
        }

        public String getShopphone() {
            return shopphone;
        }

        public void setShopphone(String shopphone) {
            this.shopphone = shopphone;
        }

        public String getShopaddr() {
            return shopaddr;
        }

        public void setShopaddr(String shopaddr) {
            this.shopaddr = shopaddr;
        }

        public String getDistance() {
            return distance;
        }

        public void setDistance(String distance) {
            this.distance = distance;
        }

        public int getMonths() {
            return months;
        }

        public void setMonths(int months) {
            this.months = months;
        }

        public boolean isIsappointment() {
            return isappointment;
        }

        public void setIsappointment(boolean isappointment) {
            this.isappointment = isappointment;
        }

        public boolean isIsdispatching() {
            return isdispatching;
        }

        public void setIsdispatching(boolean isdispatching) {
            this.isdispatching = isdispatching;
        }

        public String getStarttime() {
            return starttime;
        }

        public void setStarttime(String starttime) {
            this.starttime = starttime;
        }

        public String getEndtime() {
            return endtime;
        }

        public void setEndtime(String endtime) {
            this.endtime = endtime;
        }

        public int getPatchingscope() {
            return patchingscope;
        }

        public void setPatchingscope(int patchingscope) {
            this.patchingscope = patchingscope;
        }

        public int getDeliveryfee() {
            return deliveryfee;
        }

        public void setDeliveryfee(int deliveryfee) {
            this.deliveryfee = deliveryfee;
        }

        public boolean isSuppicbc() {
            return suppicbc;
        }

        public void setSuppicbc(boolean suppicbc) {
            this.suppicbc = suppicbc;
        }

        public int getMealfee() {
            return mealfee;
        }

        public void setMealfee(int mealfee) {
            this.mealfee = mealfee;
        }

        public List<String> getShopimage() {
            return shopimage;
        }

        public void setShopimage(List<String> shopimage) {
            this.shopimage = shopimage;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.shopname);
            dest.writeString(this.shopphone);
            dest.writeString(this.shopaddr);
            dest.writeString(this.distance);
            dest.writeInt(this.months);
            dest.writeByte(this.isappointment ? (byte) 1 : (byte) 0);
            dest.writeByte(this.isdispatching ? (byte) 1 : (byte) 0);
            dest.writeString(this.starttime);
            dest.writeString(this.endtime);
            dest.writeInt(this.patchingscope);
            dest.writeInt(this.deliveryfee);
            dest.writeByte(this.suppicbc ? (byte) 1 : (byte) 0);
            dest.writeInt(this.mealfee);
            dest.writeStringList(this.shopimage);
        }

        public ShopBean() {
        }

        protected ShopBean(Parcel in) {
            this.shopname = in.readString();
            this.shopphone = in.readString();
            this.shopaddr = in.readString();
            this.distance = in.readString();
            this.months = in.readInt();
            this.isappointment = in.readByte() != 0;
            this.isdispatching = in.readByte() != 0;
            this.starttime = in.readString();
            this.endtime = in.readString();
            this.patchingscope = in.readInt();
            this.deliveryfee = in.readInt();
            this.suppicbc = in.readByte() != 0;
            this.mealfee = in.readInt();
            this.shopimage = in.createStringArrayList();
        }

        public static final Creator<ShopBean> CREATOR = new Creator<ShopBean>() {
            @Override
            public ShopBean createFromParcel(Parcel source) {
                return new ShopBean(source);
            }

            @Override
            public ShopBean[] newArray(int size) {
                return new ShopBean[size];
            }
        };
    }

    public static class EvaluationBean implements Parcelable {

        /**
         * amount : 1
         * evaluations : [{"name":"","img":null,"star":1,"remark":"零颗星","evatime":"2018-04-20"}]
         */

        private int amount;
        private List<EvaluationsBean> evaluations;

        public int getAmount() {
            return amount;
        }

        public void setAmount(int amount) {
            this.amount = amount;
        }

        public List<EvaluationsBean> getEvaluations() {
            return evaluations;
        }

        public void setEvaluations(List<EvaluationsBean> evaluations) {
            this.evaluations = evaluations;
        }

        public static class EvaluationsBean implements Parcelable {

            /**
             * name :
             * img : null
             * star : 1
             * remark : 零颗星
             * evatime : 2018-04-20
             */

            private String name;
            private String img;
            private int star;
            private String remark;
            private String evatime;

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }

            public String getImg() {
                return img;
            }

            public void setImg(String img) {
                this.img = img;
            }

            public int getStar() {
                return star;
            }

            public void setStar(int star) {
                this.star = star;
            }

            public String getRemark() {
                return remark;
            }

            public void setRemark(String remark) {
                this.remark = remark;
            }

            public String getEvatime() {
                return evatime;
            }

            public void setEvatime(String evatime) {
                this.evatime = evatime;
            }

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeString(this.name);
                dest.writeString(this.img);
                dest.writeInt(this.star);
                dest.writeString(this.remark);
                dest.writeString(this.evatime);
            }

            public EvaluationsBean() {
            }

            protected EvaluationsBean(Parcel in) {
                this.name = in.readString();
                this.img = in.readString();
                this.star = in.readInt();
                this.remark = in.readString();
                this.evatime = in.readString();
            }

            public static final Creator<EvaluationsBean> CREATOR = new Creator<EvaluationsBean>() {
                @Override
                public EvaluationsBean createFromParcel(Parcel source) {
                    return new EvaluationsBean(source);
                }

                @Override
                public EvaluationsBean[] newArray(int size) {
                    return new EvaluationsBean[size];
                }
            };
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(this.amount);
            dest.writeList(this.evaluations);
        }

        public EvaluationBean() {
        }

        protected EvaluationBean(Parcel in) {
            this.amount = in.readInt();
            this.evaluations = new ArrayList<EvaluationsBean>();
            in.readList(this.evaluations, EvaluationsBean.class.getClassLoader());
        }

        public static final Creator<EvaluationBean> CREATOR = new Creator<EvaluationBean>() {
            @Override
            public EvaluationBean createFromParcel(Parcel source) {
                return new EvaluationBean(source);
            }

            @Override
            public EvaluationBean[] newArray(int size) {
                return new EvaluationBean[size];
            }
        };
    }

    public static class UserBean implements Parcelable {

        /**
         * degree : 4
         * rate : 0.03
         * wcoin : 0
         */

        private int degree;
        private double rate;
        private int wcoin;

        public int getDegree() {
            return degree;
        }

        public void setDegree(int degree) {
            this.degree = degree;
        }

        public double getRate() {
            return rate;
        }

        public void setRate(double rate) {
            this.rate = rate;
        }

        public int getWcoin() {
            return wcoin;
        }

        public void setWcoin(int wcoin) {
            this.wcoin = wcoin;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(this.degree);
            dest.writeDouble(this.rate);
            dest.writeInt(this.wcoin);
        }

        public UserBean() {
        }

        protected UserBean(Parcel in) {
            this.degree = in.readInt();
            this.rate = in.readDouble();
            this.wcoin = in.readInt();
        }

        public static final Creator<UserBean> CREATOR = new Creator<UserBean>() {
            @Override
            public UserBean createFromParcel(Parcel source) {
                return new UserBean(source);
            }

            @Override
            public UserBean[] newArray(int size) {
                return new UserBean[size];
            }
        };
    }

    public static class ProductBean implements Parcelable {

        /**
         * menu : 生鲜
         * icon : null
         * products : [{"id":909,"productname":"苹果","lineprice":"8.80","price":"7.90","image":"http://imgcdn.gonghuijia.cn/app_union/resources/images106/file_1522473288000.jpg","months":0},{"id":910,"productname":"芒果","lineprice":"9.90","price":"8.80","image":"http://imgcdn.gonghuijia.cn/app_union/resources/images106/file_1522473288000.jpg","months":0},{"id":18760,"productname":"橘子","lineprice":"10.00","price":"0.01","image":"http://imgcdn.gonghuijia.cn/app_union/resources/images164/file_1525832177000.jpg","months":0}]
         */

        private String menu;
        private String icon;
        private List<ProductsBean> products;

        public String getMenu() {
            return menu;
        }

        public void setMenu(String menu) {
            this.menu = menu;
        }

        public String getIcon() {
            return icon;
        }

        public void setIcon(String icon) {
            this.icon = icon;
        }

        public List<ProductsBean> getProducts() {
            return products;
        }

        public void setProducts(List<ProductsBean> products) {
            this.products = products;
        }

        public static class ProductsBean {
            /**
             * id : 909
             * productname : 苹果
             * lineprice : 8.80
             * price : 7.90
             * image : http://imgcdn.gonghuijia.cn/app_union/resources/images106/file_1522473288000.jpg
             * months : 0
             */

            private int id;
            private String productname;
            private String lineprice;
            private String price;
            private String image;
            private int months;

            public int getId() {
                return id;
            }

            public void setId(int id) {
                this.id = id;
            }

            public String getProductname() {
                return productname;
            }

            public void setProductname(String productname) {
                this.productname = productname;
            }

            public String getLineprice() {
                return lineprice;
            }

            public void setLineprice(String lineprice) {
                this.lineprice = lineprice;
            }

            public String getPrice() {
                return price;
            }

            public void setPrice(String price) {
                this.price = price;
            }

            public String getImage() {
                return image;
            }

            public void setImage(String image) {
                this.image = image;
            }

            public int getMonths() {
                return months;
            }

            public void setMonths(int months) {
                this.months = months;
            }
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.menu);
            dest.writeString(this.icon);
            dest.writeList(this.products);
        }

        public ProductBean() {
        }

        protected ProductBean(Parcel in) {
            this.menu = in.readString();
            this.icon = in.readString();
            this.products = new ArrayList<ProductsBean>();
            in.readList(this.products, ProductsBean.class.getClassLoader());
        }

        public static final Creator<ProductBean> CREATOR = new Creator<ProductBean>() {
            @Override
            public ProductBean createFromParcel(Parcel source) {
                return new ProductBean(source);
            }

            @Override
            public ProductBean[] newArray(int size) {
                return new ProductBean[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(this.shop, flags);
        dest.writeParcelable(this.evaluation, flags);
        dest.writeParcelable(this.user, flags);
        dest.writeList(this.product);
    }

    public SuperMarket() {
    }

    protected SuperMarket(Parcel in) {
        this.shop = in.readParcelable(ShopBean.class.getClassLoader());
        this.evaluation = in.readParcelable(EvaluationBean.class.getClassLoader());
        this.user = in.readParcelable(UserBean.class.getClassLoader());
        this.product = new ArrayList<ProductBean>();
        in.readList(this.product, ProductBean.class.getClassLoader());
    }

    public static final Parcelable.Creator<SuperMarket> CREATOR = new Parcelable.Creator<SuperMarket>() {
        @Override
        public SuperMarket createFromParcel(Parcel source) {
            return new SuperMarket(source);
        }

        @Override
        public SuperMarket[] newArray(int size) {
            return new SuperMarket[size];
        }
    };
}
